import request from '@/config/axios'

// 获取百度云token
export const getBaiduAccessToken = ({
  grantType = 'client_credentials',
  clientId,
  clientSecret
}) => {
  return request.post({
    url: `https://aip.baidubce.com/oauth/2.0/token?grant_type=${grantType}&client_id=${clientId}&client_secret=${clientSecret}`
  })
}

// 获取人脸实名认证token
export const getBaiduVerifyToken = ({ accessToken,planID }) => {
  return request.post({
    url: `https://aip.baidubce.com/rpc/2.0/brain/solution/faceprint/verifyToken/generate?access_token=${accessToken}`,
    headersType: 'application/json',
    data: {
      plan_id:planID
    }
  })
}

export const getDocument = (data:any) => {
  return request.post({
    url: `/api/document/query`,
    data
  })
}


export const uploadFileBase = (data:any) => {
  return request.post({
    url: `/common/uploadFileBase`,
    data,
    headersType: 'application/x-www-form-urlencoded',
  })
}

export const uploadFile = (data:any) => {
  const formData = new FormData()
  formData.append('file', data.file)
  return request.post({
    url: `/common/uploadFile`,
    data,
    headersType: 'multipart/form-data',
  })
}

export const cardRecognition = (data:any) => {
  return request.post({
    url: `/common/cardRecognition`,
    data
  })
}

export const queryDetailFy = (data:any) => {
  return request.post({
    url: `/api/document/queryDetailFy`,
    data
  })
}
export const arcFace = (data:any) => {
  return request.post({
    url: `/common/arcFace`,
    data
  })
}

export const uploadSign = (data:any) => {
  return request.post({
    url: `/api/document/uploadSign`,
    data
  })
}


export const uploadFileSys = (data:any) => {

  const formData = new FormData()
  formData.append('file', data.file)
  return request.post({
    url: `/api/sysApk/uploadFile`,
    data,
    headersType: 'multipart/form-data',
  })
}



